{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Student Alcohol Consumption"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Introduction:\n",
    "\n",
    "This time you will download a dataset from the UCI.\n",
    "\n",
    "### Step 1. Import the necessary libraries"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 48,
   "metadata": {
    "collapsed": false,
    "ExecuteTime": {
     "end_time": "2024-01-13T08:43:58.929663Z",
     "start_time": "2024-01-13T08:43:58.814109Z"
    }
   },
   "outputs": [],
   "source": [
    "import pandas as pd"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Step 2. Import the dataset from this [address](https://raw.githubusercontent.com/guipsamora/pandas_exercises/master/04_Apply/Students_Alcohol_Consumption/student-mat.csv)."
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Step 3. Assign it to a variable called df."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 49,
   "metadata": {
    "collapsed": false,
    "ExecuteTime": {
     "end_time": "2024-01-13T08:43:59.360306Z",
     "start_time": "2024-01-13T08:43:58.825675Z"
    }
   },
   "outputs": [
    {
     "data": {
      "text/plain": "    school sex  age address famsize Pstatus  Medu  Fedu      Mjob      Fjob  \\\n0       GP   F   18       U     GT3       A     4     4   at_home   teacher   \n1       GP   F   17       U     GT3       T     1     1   at_home     other   \n2       GP   F   15       U     LE3       T     1     1   at_home     other   \n3       GP   F   15       U     GT3       T     4     2    health  services   \n4       GP   F   16       U     GT3       T     3     3     other     other   \n..     ...  ..  ...     ...     ...     ...   ...   ...       ...       ...   \n390     MS   M   20       U     LE3       A     2     2  services  services   \n391     MS   M   17       U     LE3       T     3     1  services  services   \n392     MS   M   21       R     GT3       T     1     1     other     other   \n393     MS   M   18       R     LE3       T     3     2  services     other   \n394     MS   M   19       U     LE3       T     1     1     other   at_home   \n\n     ... famrel freetime  goout  Dalc  Walc health absences  G1  G2  G3  \n0    ...      4        3      4     1     1      3        6   5   6   6  \n1    ...      5        3      3     1     1      3        4   5   5   6  \n2    ...      4        3      2     2     3      3       10   7   8  10  \n3    ...      3        2      2     1     1      5        2  15  14  15  \n4    ...      4        3      2     1     2      5        4   6  10  10  \n..   ...    ...      ...    ...   ...   ...    ...      ...  ..  ..  ..  \n390  ...      5        5      4     4     5      4       11   9   9   9  \n391  ...      2        4      5     3     4      2        3  14  16  16  \n392  ...      5        5      3     3     3      3        3  10   8   7  \n393  ...      4        4      1     3     4      5        0  11  12  10  \n394  ...      3        2      3     3     3      5        5   8   9   9  \n\n[395 rows x 33 columns]",
      "text/html": "<div>\n<style scoped>\n    .dataframe tbody tr th:only-of-type {\n        vertical-align: middle;\n    }\n\n    .dataframe tbody tr th {\n        vertical-align: top;\n    }\n\n    .dataframe thead th {\n        text-align: right;\n    }\n</style>\n<table border=\"1\" class=\"dataframe\">\n  <thead>\n    <tr style=\"text-align: right;\">\n      <th></th>\n      <th>school</th>\n      <th>sex</th>\n      <th>age</th>\n      <th>address</th>\n      <th>famsize</th>\n      <th>Pstatus</th>\n      <th>Medu</th>\n      <th>Fedu</th>\n      <th>Mjob</th>\n      <th>Fjob</th>\n      <th>...</th>\n      <th>famrel</th>\n      <th>freetime</th>\n      <th>goout</th>\n      <th>Dalc</th>\n      <th>Walc</th>\n      <th>health</th>\n      <th>absences</th>\n      <th>G1</th>\n      <th>G2</th>\n      <th>G3</th>\n    </tr>\n  </thead>\n  <tbody>\n    <tr>\n      <th>0</th>\n      <td>GP</td>\n      <td>F</td>\n      <td>18</td>\n      <td>U</td>\n      <td>GT3</td>\n      <td>A</td>\n      <td>4</td>\n      <td>4</td>\n      <td>at_home</td>\n      <td>teacher</td>\n      <td>...</td>\n      <td>4</td>\n      <td>3</td>\n      <td>4</td>\n      <td>1</td>\n      <td>1</td>\n      <td>3</td>\n      <td>6</td>\n      <td>5</td>\n      <td>6</td>\n      <td>6</td>\n    </tr>\n    <tr>\n      <th>1</th>\n      <td>GP</td>\n      <td>F</td>\n      <td>17</td>\n      <td>U</td>\n      <td>GT3</td>\n      <td>T</td>\n      <td>1</td>\n      <td>1</td>\n      <td>at_home</td>\n      <td>other</td>\n      <td>...</td>\n      <td>5</td>\n      <td>3</td>\n      <td>3</td>\n      <td>1</td>\n      <td>1</td>\n      <td>3</td>\n      <td>4</td>\n      <td>5</td>\n      <td>5</td>\n      <td>6</td>\n    </tr>\n    <tr>\n      <th>2</th>\n      <td>GP</td>\n      <td>F</td>\n      <td>15</td>\n      <td>U</td>\n      <td>LE3</td>\n      <td>T</td>\n      <td>1</td>\n      <td>1</td>\n      <td>at_home</td>\n      <td>other</td>\n      <td>...</td>\n      <td>4</td>\n      <td>3</td>\n      <td>2</td>\n      <td>2</td>\n      <td>3</td>\n      <td>3</td>\n      <td>10</td>\n      <td>7</td>\n      <td>8</td>\n      <td>10</td>\n    </tr>\n    <tr>\n      <th>3</th>\n      <td>GP</td>\n      <td>F</td>\n      <td>15</td>\n      <td>U</td>\n      <td>GT3</td>\n      <td>T</td>\n      <td>4</td>\n      <td>2</td>\n      <td>health</td>\n      <td>services</td>\n      <td>...</td>\n      <td>3</td>\n      <td>2</td>\n      <td>2</td>\n      <td>1</td>\n      <td>1</td>\n      <td>5</td>\n      <td>2</td>\n      <td>15</td>\n      <td>14</td>\n      <td>15</td>\n    </tr>\n    <tr>\n      <th>4</th>\n      <td>GP</td>\n      <td>F</td>\n      <td>16</td>\n      <td>U</td>\n      <td>GT3</td>\n      <td>T</td>\n      <td>3</td>\n      <td>3</td>\n      <td>other</td>\n      <td>other</td>\n      <td>...</td>\n      <td>4</td>\n      <td>3</td>\n      <td>2</td>\n      <td>1</td>\n      <td>2</td>\n      <td>5</td>\n      <td>4</td>\n      <td>6</td>\n      <td>10</td>\n      <td>10</td>\n    </tr>\n    <tr>\n      <th>...</th>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n    </tr>\n    <tr>\n      <th>390</th>\n      <td>MS</td>\n      <td>M</td>\n      <td>20</td>\n      <td>U</td>\n      <td>LE3</td>\n      <td>A</td>\n      <td>2</td>\n      <td>2</td>\n      <td>services</td>\n      <td>services</td>\n      <td>...</td>\n      <td>5</td>\n      <td>5</td>\n      <td>4</td>\n      <td>4</td>\n      <td>5</td>\n      <td>4</td>\n      <td>11</td>\n      <td>9</td>\n      <td>9</td>\n      <td>9</td>\n    </tr>\n    <tr>\n      <th>391</th>\n      <td>MS</td>\n      <td>M</td>\n      <td>17</td>\n      <td>U</td>\n      <td>LE3</td>\n      <td>T</td>\n      <td>3</td>\n      <td>1</td>\n      <td>services</td>\n      <td>services</td>\n      <td>...</td>\n      <td>2</td>\n      <td>4</td>\n      <td>5</td>\n      <td>3</td>\n      <td>4</td>\n      <td>2</td>\n      <td>3</td>\n      <td>14</td>\n      <td>16</td>\n      <td>16</td>\n    </tr>\n    <tr>\n      <th>392</th>\n      <td>MS</td>\n      <td>M</td>\n      <td>21</td>\n      <td>R</td>\n      <td>GT3</td>\n      <td>T</td>\n      <td>1</td>\n      <td>1</td>\n      <td>other</td>\n      <td>other</td>\n      <td>...</td>\n      <td>5</td>\n      <td>5</td>\n      <td>3</td>\n      <td>3</td>\n      <td>3</td>\n      <td>3</td>\n      <td>3</td>\n      <td>10</td>\n      <td>8</td>\n      <td>7</td>\n    </tr>\n    <tr>\n      <th>393</th>\n      <td>MS</td>\n      <td>M</td>\n      <td>18</td>\n      <td>R</td>\n      <td>LE3</td>\n      <td>T</td>\n      <td>3</td>\n      <td>2</td>\n      <td>services</td>\n      <td>other</td>\n      <td>...</td>\n      <td>4</td>\n      <td>4</td>\n      <td>1</td>\n      <td>3</td>\n      <td>4</td>\n      <td>5</td>\n      <td>0</td>\n      <td>11</td>\n      <td>12</td>\n      <td>10</td>\n    </tr>\n    <tr>\n      <th>394</th>\n      <td>MS</td>\n      <td>M</td>\n      <td>19</td>\n      <td>U</td>\n      <td>LE3</td>\n      <td>T</td>\n      <td>1</td>\n      <td>1</td>\n      <td>other</td>\n      <td>at_home</td>\n      <td>...</td>\n      <td>3</td>\n      <td>2</td>\n      <td>3</td>\n      <td>3</td>\n      <td>3</td>\n      <td>5</td>\n      <td>5</td>\n      <td>8</td>\n      <td>9</td>\n      <td>9</td>\n    </tr>\n  </tbody>\n</table>\n<p>395 rows × 33 columns</p>\n</div>"
     },
     "execution_count": 49,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df = pd.read_csv(\"https://raw.githubusercontent.com/guipsamora/pandas_exercises/master/04_Apply/Students_Alcohol_Consumption/student-mat.csv\")\n",
    "df"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Step 4. For the purpose of this exercise slice the dataframe from 'school' until the 'guardian' column"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 50,
   "metadata": {
    "collapsed": false,
    "ExecuteTime": {
     "end_time": "2024-01-13T08:43:59.376245Z",
     "start_time": "2024-01-13T08:43:59.371392Z"
    }
   },
   "outputs": [
    {
     "data": {
      "text/plain": "    school sex  age address famsize Pstatus  Medu  Fedu      Mjob      Fjob  \\\n0       GP   F   18       U     GT3       A     4     4   at_home   teacher   \n1       GP   F   17       U     GT3       T     1     1   at_home     other   \n2       GP   F   15       U     LE3       T     1     1   at_home     other   \n3       GP   F   15       U     GT3       T     4     2    health  services   \n4       GP   F   16       U     GT3       T     3     3     other     other   \n..     ...  ..  ...     ...     ...     ...   ...   ...       ...       ...   \n390     MS   M   20       U     LE3       A     2     2  services  services   \n391     MS   M   17       U     LE3       T     3     1  services  services   \n392     MS   M   21       R     GT3       T     1     1     other     other   \n393     MS   M   18       R     LE3       T     3     2  services     other   \n394     MS   M   19       U     LE3       T     1     1     other   at_home   \n\n     reason guardian  \n0    course   mother  \n1    course   father  \n2     other   mother  \n3      home   mother  \n4      home   father  \n..      ...      ...  \n390  course    other  \n391  course   mother  \n392  course    other  \n393  course   mother  \n394  course   father  \n\n[395 rows x 12 columns]",
      "text/html": "<div>\n<style scoped>\n    .dataframe tbody tr th:only-of-type {\n        vertical-align: middle;\n    }\n\n    .dataframe tbody tr th {\n        vertical-align: top;\n    }\n\n    .dataframe thead th {\n        text-align: right;\n    }\n</style>\n<table border=\"1\" class=\"dataframe\">\n  <thead>\n    <tr style=\"text-align: right;\">\n      <th></th>\n      <th>school</th>\n      <th>sex</th>\n      <th>age</th>\n      <th>address</th>\n      <th>famsize</th>\n      <th>Pstatus</th>\n      <th>Medu</th>\n      <th>Fedu</th>\n      <th>Mjob</th>\n      <th>Fjob</th>\n      <th>reason</th>\n      <th>guardian</th>\n    </tr>\n  </thead>\n  <tbody>\n    <tr>\n      <th>0</th>\n      <td>GP</td>\n      <td>F</td>\n      <td>18</td>\n      <td>U</td>\n      <td>GT3</td>\n      <td>A</td>\n      <td>4</td>\n      <td>4</td>\n      <td>at_home</td>\n      <td>teacher</td>\n      <td>course</td>\n      <td>mother</td>\n    </tr>\n    <tr>\n      <th>1</th>\n      <td>GP</td>\n      <td>F</td>\n      <td>17</td>\n      <td>U</td>\n      <td>GT3</td>\n      <td>T</td>\n      <td>1</td>\n      <td>1</td>\n      <td>at_home</td>\n      <td>other</td>\n      <td>course</td>\n      <td>father</td>\n    </tr>\n    <tr>\n      <th>2</th>\n      <td>GP</td>\n      <td>F</td>\n      <td>15</td>\n      <td>U</td>\n      <td>LE3</td>\n      <td>T</td>\n      <td>1</td>\n      <td>1</td>\n      <td>at_home</td>\n      <td>other</td>\n      <td>other</td>\n      <td>mother</td>\n    </tr>\n    <tr>\n      <th>3</th>\n      <td>GP</td>\n      <td>F</td>\n      <td>15</td>\n      <td>U</td>\n      <td>GT3</td>\n      <td>T</td>\n      <td>4</td>\n      <td>2</td>\n      <td>health</td>\n      <td>services</td>\n      <td>home</td>\n      <td>mother</td>\n    </tr>\n    <tr>\n      <th>4</th>\n      <td>GP</td>\n      <td>F</td>\n      <td>16</td>\n      <td>U</td>\n      <td>GT3</td>\n      <td>T</td>\n      <td>3</td>\n      <td>3</td>\n      <td>other</td>\n      <td>other</td>\n      <td>home</td>\n      <td>father</td>\n    </tr>\n    <tr>\n      <th>...</th>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n    </tr>\n    <tr>\n      <th>390</th>\n      <td>MS</td>\n      <td>M</td>\n      <td>20</td>\n      <td>U</td>\n      <td>LE3</td>\n      <td>A</td>\n      <td>2</td>\n      <td>2</td>\n      <td>services</td>\n      <td>services</td>\n      <td>course</td>\n      <td>other</td>\n    </tr>\n    <tr>\n      <th>391</th>\n      <td>MS</td>\n      <td>M</td>\n      <td>17</td>\n      <td>U</td>\n      <td>LE3</td>\n      <td>T</td>\n      <td>3</td>\n      <td>1</td>\n      <td>services</td>\n      <td>services</td>\n      <td>course</td>\n      <td>mother</td>\n    </tr>\n    <tr>\n      <th>392</th>\n      <td>MS</td>\n      <td>M</td>\n      <td>21</td>\n      <td>R</td>\n      <td>GT3</td>\n      <td>T</td>\n      <td>1</td>\n      <td>1</td>\n      <td>other</td>\n      <td>other</td>\n      <td>course</td>\n      <td>other</td>\n    </tr>\n    <tr>\n      <th>393</th>\n      <td>MS</td>\n      <td>M</td>\n      <td>18</td>\n      <td>R</td>\n      <td>LE3</td>\n      <td>T</td>\n      <td>3</td>\n      <td>2</td>\n      <td>services</td>\n      <td>other</td>\n      <td>course</td>\n      <td>mother</td>\n    </tr>\n    <tr>\n      <th>394</th>\n      <td>MS</td>\n      <td>M</td>\n      <td>19</td>\n      <td>U</td>\n      <td>LE3</td>\n      <td>T</td>\n      <td>1</td>\n      <td>1</td>\n      <td>other</td>\n      <td>at_home</td>\n      <td>course</td>\n      <td>father</td>\n    </tr>\n  </tbody>\n</table>\n<p>395 rows × 12 columns</p>\n</div>"
     },
     "execution_count": 50,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "school_index = df.columns.get_loc(\"school\")\n",
    "guardian_index = df.columns.get_loc(\"guardian\")\n",
    "df.iloc[:, school_index:guardian_index + 1]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 51,
   "outputs": [
    {
     "data": {
      "text/plain": "    school sex  age address famsize Pstatus  Medu  Fedu      Mjob      Fjob  \\\n0       GP   F   18       U     GT3       A     4     4   at_home   teacher   \n1       GP   F   17       U     GT3       T     1     1   at_home     other   \n2       GP   F   15       U     LE3       T     1     1   at_home     other   \n3       GP   F   15       U     GT3       T     4     2    health  services   \n4       GP   F   16       U     GT3       T     3     3     other     other   \n..     ...  ..  ...     ...     ...     ...   ...   ...       ...       ...   \n390     MS   M   20       U     LE3       A     2     2  services  services   \n391     MS   M   17       U     LE3       T     3     1  services  services   \n392     MS   M   21       R     GT3       T     1     1     other     other   \n393     MS   M   18       R     LE3       T     3     2  services     other   \n394     MS   M   19       U     LE3       T     1     1     other   at_home   \n\n     reason guardian  \n0    course   mother  \n1    course   father  \n2     other   mother  \n3      home   mother  \n4      home   father  \n..      ...      ...  \n390  course    other  \n391  course   mother  \n392  course    other  \n393  course   mother  \n394  course   father  \n\n[395 rows x 12 columns]",
      "text/html": "<div>\n<style scoped>\n    .dataframe tbody tr th:only-of-type {\n        vertical-align: middle;\n    }\n\n    .dataframe tbody tr th {\n        vertical-align: top;\n    }\n\n    .dataframe thead th {\n        text-align: right;\n    }\n</style>\n<table border=\"1\" class=\"dataframe\">\n  <thead>\n    <tr style=\"text-align: right;\">\n      <th></th>\n      <th>school</th>\n      <th>sex</th>\n      <th>age</th>\n      <th>address</th>\n      <th>famsize</th>\n      <th>Pstatus</th>\n      <th>Medu</th>\n      <th>Fedu</th>\n      <th>Mjob</th>\n      <th>Fjob</th>\n      <th>reason</th>\n      <th>guardian</th>\n    </tr>\n  </thead>\n  <tbody>\n    <tr>\n      <th>0</th>\n      <td>GP</td>\n      <td>F</td>\n      <td>18</td>\n      <td>U</td>\n      <td>GT3</td>\n      <td>A</td>\n      <td>4</td>\n      <td>4</td>\n      <td>at_home</td>\n      <td>teacher</td>\n      <td>course</td>\n      <td>mother</td>\n    </tr>\n    <tr>\n      <th>1</th>\n      <td>GP</td>\n      <td>F</td>\n      <td>17</td>\n      <td>U</td>\n      <td>GT3</td>\n      <td>T</td>\n      <td>1</td>\n      <td>1</td>\n      <td>at_home</td>\n      <td>other</td>\n      <td>course</td>\n      <td>father</td>\n    </tr>\n    <tr>\n      <th>2</th>\n      <td>GP</td>\n      <td>F</td>\n      <td>15</td>\n      <td>U</td>\n      <td>LE3</td>\n      <td>T</td>\n      <td>1</td>\n      <td>1</td>\n      <td>at_home</td>\n      <td>other</td>\n      <td>other</td>\n      <td>mother</td>\n    </tr>\n    <tr>\n      <th>3</th>\n      <td>GP</td>\n      <td>F</td>\n      <td>15</td>\n      <td>U</td>\n      <td>GT3</td>\n      <td>T</td>\n      <td>4</td>\n      <td>2</td>\n      <td>health</td>\n      <td>services</td>\n      <td>home</td>\n      <td>mother</td>\n    </tr>\n    <tr>\n      <th>4</th>\n      <td>GP</td>\n      <td>F</td>\n      <td>16</td>\n      <td>U</td>\n      <td>GT3</td>\n      <td>T</td>\n      <td>3</td>\n      <td>3</td>\n      <td>other</td>\n      <td>other</td>\n      <td>home</td>\n      <td>father</td>\n    </tr>\n    <tr>\n      <th>...</th>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n    </tr>\n    <tr>\n      <th>390</th>\n      <td>MS</td>\n      <td>M</td>\n      <td>20</td>\n      <td>U</td>\n      <td>LE3</td>\n      <td>A</td>\n      <td>2</td>\n      <td>2</td>\n      <td>services</td>\n      <td>services</td>\n      <td>course</td>\n      <td>other</td>\n    </tr>\n    <tr>\n      <th>391</th>\n      <td>MS</td>\n      <td>M</td>\n      <td>17</td>\n      <td>U</td>\n      <td>LE3</td>\n      <td>T</td>\n      <td>3</td>\n      <td>1</td>\n      <td>services</td>\n      <td>services</td>\n      <td>course</td>\n      <td>mother</td>\n    </tr>\n    <tr>\n      <th>392</th>\n      <td>MS</td>\n      <td>M</td>\n      <td>21</td>\n      <td>R</td>\n      <td>GT3</td>\n      <td>T</td>\n      <td>1</td>\n      <td>1</td>\n      <td>other</td>\n      <td>other</td>\n      <td>course</td>\n      <td>other</td>\n    </tr>\n    <tr>\n      <th>393</th>\n      <td>MS</td>\n      <td>M</td>\n      <td>18</td>\n      <td>R</td>\n      <td>LE3</td>\n      <td>T</td>\n      <td>3</td>\n      <td>2</td>\n      <td>services</td>\n      <td>other</td>\n      <td>course</td>\n      <td>mother</td>\n    </tr>\n    <tr>\n      <th>394</th>\n      <td>MS</td>\n      <td>M</td>\n      <td>19</td>\n      <td>U</td>\n      <td>LE3</td>\n      <td>T</td>\n      <td>1</td>\n      <td>1</td>\n      <td>other</td>\n      <td>at_home</td>\n      <td>course</td>\n      <td>father</td>\n    </tr>\n  </tbody>\n</table>\n<p>395 rows × 12 columns</p>\n</div>"
     },
     "execution_count": 51,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df.loc[:,\"school\":\"guardian\"]"
   ],
   "metadata": {
    "collapsed": false,
    "ExecuteTime": {
     "end_time": "2024-01-13T08:43:59.461798Z",
     "start_time": "2024-01-13T08:43:59.384956Z"
    }
   }
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Step 5. Create a lambda function that will capitalize strings."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 52,
   "metadata": {
    "collapsed": false,
    "ExecuteTime": {
     "end_time": "2024-01-13T08:43:59.473324Z",
     "start_time": "2024-01-13T08:43:59.392964Z"
    }
   },
   "outputs": [],
   "source": [
    "capitalizer = lambda x: x.capitalize()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Step 6. Capitalize both Mjob and Fjob"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 53,
   "metadata": {
    "collapsed": false,
    "ExecuteTime": {
     "end_time": "2024-01-13T08:43:59.535306Z",
     "start_time": "2024-01-13T08:43:59.413471Z"
    }
   },
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "/var/folders/wp/lkkwcrwn3zj0rrhwk9j6lffm0000gn/T/ipykernel_7733/1421047727.py:1: FutureWarning: DataFrame.applymap has been deprecated. Use DataFrame.map instead.\n",
      "  df[[\"Mjob\",\"Fjob\"]] = df[[\"Mjob\",\"Fjob\"]].applymap(capitalizer)\n"
     ]
    },
    {
     "data": {
      "text/plain": "    school sex  age address famsize Pstatus  Medu  Fedu      Mjob      Fjob  \\\n0       GP   F   18       U     GT3       A     4     4   At_home   Teacher   \n1       GP   F   17       U     GT3       T     1     1   At_home     Other   \n2       GP   F   15       U     LE3       T     1     1   At_home     Other   \n3       GP   F   15       U     GT3       T     4     2    Health  Services   \n4       GP   F   16       U     GT3       T     3     3     Other     Other   \n..     ...  ..  ...     ...     ...     ...   ...   ...       ...       ...   \n390     MS   M   20       U     LE3       A     2     2  Services  Services   \n391     MS   M   17       U     LE3       T     3     1  Services  Services   \n392     MS   M   21       R     GT3       T     1     1     Other     Other   \n393     MS   M   18       R     LE3       T     3     2  Services     Other   \n394     MS   M   19       U     LE3       T     1     1     Other   At_home   \n\n     ... famrel freetime  goout  Dalc  Walc health absences  G1  G2  G3  \n0    ...      4        3      4     1     1      3        6   5   6   6  \n1    ...      5        3      3     1     1      3        4   5   5   6  \n2    ...      4        3      2     2     3      3       10   7   8  10  \n3    ...      3        2      2     1     1      5        2  15  14  15  \n4    ...      4        3      2     1     2      5        4   6  10  10  \n..   ...    ...      ...    ...   ...   ...    ...      ...  ..  ..  ..  \n390  ...      5        5      4     4     5      4       11   9   9   9  \n391  ...      2        4      5     3     4      2        3  14  16  16  \n392  ...      5        5      3     3     3      3        3  10   8   7  \n393  ...      4        4      1     3     4      5        0  11  12  10  \n394  ...      3        2      3     3     3      5        5   8   9   9  \n\n[395 rows x 33 columns]",
      "text/html": "<div>\n<style scoped>\n    .dataframe tbody tr th:only-of-type {\n        vertical-align: middle;\n    }\n\n    .dataframe tbody tr th {\n        vertical-align: top;\n    }\n\n    .dataframe thead th {\n        text-align: right;\n    }\n</style>\n<table border=\"1\" class=\"dataframe\">\n  <thead>\n    <tr style=\"text-align: right;\">\n      <th></th>\n      <th>school</th>\n      <th>sex</th>\n      <th>age</th>\n      <th>address</th>\n      <th>famsize</th>\n      <th>Pstatus</th>\n      <th>Medu</th>\n      <th>Fedu</th>\n      <th>Mjob</th>\n      <th>Fjob</th>\n      <th>...</th>\n      <th>famrel</th>\n      <th>freetime</th>\n      <th>goout</th>\n      <th>Dalc</th>\n      <th>Walc</th>\n      <th>health</th>\n      <th>absences</th>\n      <th>G1</th>\n      <th>G2</th>\n      <th>G3</th>\n    </tr>\n  </thead>\n  <tbody>\n    <tr>\n      <th>0</th>\n      <td>GP</td>\n      <td>F</td>\n      <td>18</td>\n      <td>U</td>\n      <td>GT3</td>\n      <td>A</td>\n      <td>4</td>\n      <td>4</td>\n      <td>At_home</td>\n      <td>Teacher</td>\n      <td>...</td>\n      <td>4</td>\n      <td>3</td>\n      <td>4</td>\n      <td>1</td>\n      <td>1</td>\n      <td>3</td>\n      <td>6</td>\n      <td>5</td>\n      <td>6</td>\n      <td>6</td>\n    </tr>\n    <tr>\n      <th>1</th>\n      <td>GP</td>\n      <td>F</td>\n      <td>17</td>\n      <td>U</td>\n      <td>GT3</td>\n      <td>T</td>\n      <td>1</td>\n      <td>1</td>\n      <td>At_home</td>\n      <td>Other</td>\n      <td>...</td>\n      <td>5</td>\n      <td>3</td>\n      <td>3</td>\n      <td>1</td>\n      <td>1</td>\n      <td>3</td>\n      <td>4</td>\n      <td>5</td>\n      <td>5</td>\n      <td>6</td>\n    </tr>\n    <tr>\n      <th>2</th>\n      <td>GP</td>\n      <td>F</td>\n      <td>15</td>\n      <td>U</td>\n      <td>LE3</td>\n      <td>T</td>\n      <td>1</td>\n      <td>1</td>\n      <td>At_home</td>\n      <td>Other</td>\n      <td>...</td>\n      <td>4</td>\n      <td>3</td>\n      <td>2</td>\n      <td>2</td>\n      <td>3</td>\n      <td>3</td>\n      <td>10</td>\n      <td>7</td>\n      <td>8</td>\n      <td>10</td>\n    </tr>\n    <tr>\n      <th>3</th>\n      <td>GP</td>\n      <td>F</td>\n      <td>15</td>\n      <td>U</td>\n      <td>GT3</td>\n      <td>T</td>\n      <td>4</td>\n      <td>2</td>\n      <td>Health</td>\n      <td>Services</td>\n      <td>...</td>\n      <td>3</td>\n      <td>2</td>\n      <td>2</td>\n      <td>1</td>\n      <td>1</td>\n      <td>5</td>\n      <td>2</td>\n      <td>15</td>\n      <td>14</td>\n      <td>15</td>\n    </tr>\n    <tr>\n      <th>4</th>\n      <td>GP</td>\n      <td>F</td>\n      <td>16</td>\n      <td>U</td>\n      <td>GT3</td>\n      <td>T</td>\n      <td>3</td>\n      <td>3</td>\n      <td>Other</td>\n      <td>Other</td>\n      <td>...</td>\n      <td>4</td>\n      <td>3</td>\n      <td>2</td>\n      <td>1</td>\n      <td>2</td>\n      <td>5</td>\n      <td>4</td>\n      <td>6</td>\n      <td>10</td>\n      <td>10</td>\n    </tr>\n    <tr>\n      <th>...</th>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n    </tr>\n    <tr>\n      <th>390</th>\n      <td>MS</td>\n      <td>M</td>\n      <td>20</td>\n      <td>U</td>\n      <td>LE3</td>\n      <td>A</td>\n      <td>2</td>\n      <td>2</td>\n      <td>Services</td>\n      <td>Services</td>\n      <td>...</td>\n      <td>5</td>\n      <td>5</td>\n      <td>4</td>\n      <td>4</td>\n      <td>5</td>\n      <td>4</td>\n      <td>11</td>\n      <td>9</td>\n      <td>9</td>\n      <td>9</td>\n    </tr>\n    <tr>\n      <th>391</th>\n      <td>MS</td>\n      <td>M</td>\n      <td>17</td>\n      <td>U</td>\n      <td>LE3</td>\n      <td>T</td>\n      <td>3</td>\n      <td>1</td>\n      <td>Services</td>\n      <td>Services</td>\n      <td>...</td>\n      <td>2</td>\n      <td>4</td>\n      <td>5</td>\n      <td>3</td>\n      <td>4</td>\n      <td>2</td>\n      <td>3</td>\n      <td>14</td>\n      <td>16</td>\n      <td>16</td>\n    </tr>\n    <tr>\n      <th>392</th>\n      <td>MS</td>\n      <td>M</td>\n      <td>21</td>\n      <td>R</td>\n      <td>GT3</td>\n      <td>T</td>\n      <td>1</td>\n      <td>1</td>\n      <td>Other</td>\n      <td>Other</td>\n      <td>...</td>\n      <td>5</td>\n      <td>5</td>\n      <td>3</td>\n      <td>3</td>\n      <td>3</td>\n      <td>3</td>\n      <td>3</td>\n      <td>10</td>\n      <td>8</td>\n      <td>7</td>\n    </tr>\n    <tr>\n      <th>393</th>\n      <td>MS</td>\n      <td>M</td>\n      <td>18</td>\n      <td>R</td>\n      <td>LE3</td>\n      <td>T</td>\n      <td>3</td>\n      <td>2</td>\n      <td>Services</td>\n      <td>Other</td>\n      <td>...</td>\n      <td>4</td>\n      <td>4</td>\n      <td>1</td>\n      <td>3</td>\n      <td>4</td>\n      <td>5</td>\n      <td>0</td>\n      <td>11</td>\n      <td>12</td>\n      <td>10</td>\n    </tr>\n    <tr>\n      <th>394</th>\n      <td>MS</td>\n      <td>M</td>\n      <td>19</td>\n      <td>U</td>\n      <td>LE3</td>\n      <td>T</td>\n      <td>1</td>\n      <td>1</td>\n      <td>Other</td>\n      <td>At_home</td>\n      <td>...</td>\n      <td>3</td>\n      <td>2</td>\n      <td>3</td>\n      <td>3</td>\n      <td>3</td>\n      <td>5</td>\n      <td>5</td>\n      <td>8</td>\n      <td>9</td>\n      <td>9</td>\n    </tr>\n  </tbody>\n</table>\n<p>395 rows × 33 columns</p>\n</div>"
     },
     "execution_count": 53,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df[[\"Mjob\",\"Fjob\"]] = df[[\"Mjob\",\"Fjob\"]].applymap(capitalizer)\n",
    "df"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Step 7. Print the last elements of the data set."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 54,
   "metadata": {
    "collapsed": false,
    "ExecuteTime": {
     "end_time": "2024-01-13T08:43:59.536357Z",
     "start_time": "2024-01-13T08:43:59.430278Z"
    }
   },
   "outputs": [
    {
     "data": {
      "text/plain": "    school sex  age address famsize Pstatus  Medu  Fedu   Mjob     Fjob  ...  \\\n394     MS   M   19       U     LE3       T     1     1  Other  At_home  ...   \n\n    famrel freetime  goout  Dalc  Walc health absences G1 G2 G3  \n394      3        2      3     3     3      5        5  8  9  9  \n\n[1 rows x 33 columns]",
      "text/html": "<div>\n<style scoped>\n    .dataframe tbody tr th:only-of-type {\n        vertical-align: middle;\n    }\n\n    .dataframe tbody tr th {\n        vertical-align: top;\n    }\n\n    .dataframe thead th {\n        text-align: right;\n    }\n</style>\n<table border=\"1\" class=\"dataframe\">\n  <thead>\n    <tr style=\"text-align: right;\">\n      <th></th>\n      <th>school</th>\n      <th>sex</th>\n      <th>age</th>\n      <th>address</th>\n      <th>famsize</th>\n      <th>Pstatus</th>\n      <th>Medu</th>\n      <th>Fedu</th>\n      <th>Mjob</th>\n      <th>Fjob</th>\n      <th>...</th>\n      <th>famrel</th>\n      <th>freetime</th>\n      <th>goout</th>\n      <th>Dalc</th>\n      <th>Walc</th>\n      <th>health</th>\n      <th>absences</th>\n      <th>G1</th>\n      <th>G2</th>\n      <th>G3</th>\n    </tr>\n  </thead>\n  <tbody>\n    <tr>\n      <th>394</th>\n      <td>MS</td>\n      <td>M</td>\n      <td>19</td>\n      <td>U</td>\n      <td>LE3</td>\n      <td>T</td>\n      <td>1</td>\n      <td>1</td>\n      <td>Other</td>\n      <td>At_home</td>\n      <td>...</td>\n      <td>3</td>\n      <td>2</td>\n      <td>3</td>\n      <td>3</td>\n      <td>3</td>\n      <td>5</td>\n      <td>5</td>\n      <td>8</td>\n      <td>9</td>\n      <td>9</td>\n    </tr>\n  </tbody>\n</table>\n<p>1 rows × 33 columns</p>\n</div>"
     },
     "execution_count": 54,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df.tail(1)\n",
    "df.iloc[[-1]]"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Step 8. Did you notice the original dataframe is still lowercase? Why is that? Fix it and capitalize Mjob and Fjob."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 55,
   "metadata": {
    "collapsed": false,
    "ExecuteTime": {
     "end_time": "2024-01-13T08:43:59.538329Z",
     "start_time": "2024-01-13T08:43:59.441248Z"
    }
   },
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "/var/folders/wp/lkkwcrwn3zj0rrhwk9j6lffm0000gn/T/ipykernel_7733/1421047727.py:1: FutureWarning: DataFrame.applymap has been deprecated. Use DataFrame.map instead.\n",
      "  df[[\"Mjob\",\"Fjob\"]] = df[[\"Mjob\",\"Fjob\"]].applymap(capitalizer)\n"
     ]
    },
    {
     "data": {
      "text/plain": "    school sex  age address famsize Pstatus  Medu  Fedu      Mjob      Fjob  \\\n0       GP   F   18       U     GT3       A     4     4   At_home   Teacher   \n1       GP   F   17       U     GT3       T     1     1   At_home     Other   \n2       GP   F   15       U     LE3       T     1     1   At_home     Other   \n3       GP   F   15       U     GT3       T     4     2    Health  Services   \n4       GP   F   16       U     GT3       T     3     3     Other     Other   \n..     ...  ..  ...     ...     ...     ...   ...   ...       ...       ...   \n390     MS   M   20       U     LE3       A     2     2  Services  Services   \n391     MS   M   17       U     LE3       T     3     1  Services  Services   \n392     MS   M   21       R     GT3       T     1     1     Other     Other   \n393     MS   M   18       R     LE3       T     3     2  Services     Other   \n394     MS   M   19       U     LE3       T     1     1     Other   At_home   \n\n     ... famrel freetime  goout  Dalc  Walc health absences  G1  G2  G3  \n0    ...      4        3      4     1     1      3        6   5   6   6  \n1    ...      5        3      3     1     1      3        4   5   5   6  \n2    ...      4        3      2     2     3      3       10   7   8  10  \n3    ...      3        2      2     1     1      5        2  15  14  15  \n4    ...      4        3      2     1     2      5        4   6  10  10  \n..   ...    ...      ...    ...   ...   ...    ...      ...  ..  ..  ..  \n390  ...      5        5      4     4     5      4       11   9   9   9  \n391  ...      2        4      5     3     4      2        3  14  16  16  \n392  ...      5        5      3     3     3      3        3  10   8   7  \n393  ...      4        4      1     3     4      5        0  11  12  10  \n394  ...      3        2      3     3     3      5        5   8   9   9  \n\n[395 rows x 33 columns]",
      "text/html": "<div>\n<style scoped>\n    .dataframe tbody tr th:only-of-type {\n        vertical-align: middle;\n    }\n\n    .dataframe tbody tr th {\n        vertical-align: top;\n    }\n\n    .dataframe thead th {\n        text-align: right;\n    }\n</style>\n<table border=\"1\" class=\"dataframe\">\n  <thead>\n    <tr style=\"text-align: right;\">\n      <th></th>\n      <th>school</th>\n      <th>sex</th>\n      <th>age</th>\n      <th>address</th>\n      <th>famsize</th>\n      <th>Pstatus</th>\n      <th>Medu</th>\n      <th>Fedu</th>\n      <th>Mjob</th>\n      <th>Fjob</th>\n      <th>...</th>\n      <th>famrel</th>\n      <th>freetime</th>\n      <th>goout</th>\n      <th>Dalc</th>\n      <th>Walc</th>\n      <th>health</th>\n      <th>absences</th>\n      <th>G1</th>\n      <th>G2</th>\n      <th>G3</th>\n    </tr>\n  </thead>\n  <tbody>\n    <tr>\n      <th>0</th>\n      <td>GP</td>\n      <td>F</td>\n      <td>18</td>\n      <td>U</td>\n      <td>GT3</td>\n      <td>A</td>\n      <td>4</td>\n      <td>4</td>\n      <td>At_home</td>\n      <td>Teacher</td>\n      <td>...</td>\n      <td>4</td>\n      <td>3</td>\n      <td>4</td>\n      <td>1</td>\n      <td>1</td>\n      <td>3</td>\n      <td>6</td>\n      <td>5</td>\n      <td>6</td>\n      <td>6</td>\n    </tr>\n    <tr>\n      <th>1</th>\n      <td>GP</td>\n      <td>F</td>\n      <td>17</td>\n      <td>U</td>\n      <td>GT3</td>\n      <td>T</td>\n      <td>1</td>\n      <td>1</td>\n      <td>At_home</td>\n      <td>Other</td>\n      <td>...</td>\n      <td>5</td>\n      <td>3</td>\n      <td>3</td>\n      <td>1</td>\n      <td>1</td>\n      <td>3</td>\n      <td>4</td>\n      <td>5</td>\n      <td>5</td>\n      <td>6</td>\n    </tr>\n    <tr>\n      <th>2</th>\n      <td>GP</td>\n      <td>F</td>\n      <td>15</td>\n      <td>U</td>\n      <td>LE3</td>\n      <td>T</td>\n      <td>1</td>\n      <td>1</td>\n      <td>At_home</td>\n      <td>Other</td>\n      <td>...</td>\n      <td>4</td>\n      <td>3</td>\n      <td>2</td>\n      <td>2</td>\n      <td>3</td>\n      <td>3</td>\n      <td>10</td>\n      <td>7</td>\n      <td>8</td>\n      <td>10</td>\n    </tr>\n    <tr>\n      <th>3</th>\n      <td>GP</td>\n      <td>F</td>\n      <td>15</td>\n      <td>U</td>\n      <td>GT3</td>\n      <td>T</td>\n      <td>4</td>\n      <td>2</td>\n      <td>Health</td>\n      <td>Services</td>\n      <td>...</td>\n      <td>3</td>\n      <td>2</td>\n      <td>2</td>\n      <td>1</td>\n      <td>1</td>\n      <td>5</td>\n      <td>2</td>\n      <td>15</td>\n      <td>14</td>\n      <td>15</td>\n    </tr>\n    <tr>\n      <th>4</th>\n      <td>GP</td>\n      <td>F</td>\n      <td>16</td>\n      <td>U</td>\n      <td>GT3</td>\n      <td>T</td>\n      <td>3</td>\n      <td>3</td>\n      <td>Other</td>\n      <td>Other</td>\n      <td>...</td>\n      <td>4</td>\n      <td>3</td>\n      <td>2</td>\n      <td>1</td>\n      <td>2</td>\n      <td>5</td>\n      <td>4</td>\n      <td>6</td>\n      <td>10</td>\n      <td>10</td>\n    </tr>\n    <tr>\n      <th>...</th>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n    </tr>\n    <tr>\n      <th>390</th>\n      <td>MS</td>\n      <td>M</td>\n      <td>20</td>\n      <td>U</td>\n      <td>LE3</td>\n      <td>A</td>\n      <td>2</td>\n      <td>2</td>\n      <td>Services</td>\n      <td>Services</td>\n      <td>...</td>\n      <td>5</td>\n      <td>5</td>\n      <td>4</td>\n      <td>4</td>\n      <td>5</td>\n      <td>4</td>\n      <td>11</td>\n      <td>9</td>\n      <td>9</td>\n      <td>9</td>\n    </tr>\n    <tr>\n      <th>391</th>\n      <td>MS</td>\n      <td>M</td>\n      <td>17</td>\n      <td>U</td>\n      <td>LE3</td>\n      <td>T</td>\n      <td>3</td>\n      <td>1</td>\n      <td>Services</td>\n      <td>Services</td>\n      <td>...</td>\n      <td>2</td>\n      <td>4</td>\n      <td>5</td>\n      <td>3</td>\n      <td>4</td>\n      <td>2</td>\n      <td>3</td>\n      <td>14</td>\n      <td>16</td>\n      <td>16</td>\n    </tr>\n    <tr>\n      <th>392</th>\n      <td>MS</td>\n      <td>M</td>\n      <td>21</td>\n      <td>R</td>\n      <td>GT3</td>\n      <td>T</td>\n      <td>1</td>\n      <td>1</td>\n      <td>Other</td>\n      <td>Other</td>\n      <td>...</td>\n      <td>5</td>\n      <td>5</td>\n      <td>3</td>\n      <td>3</td>\n      <td>3</td>\n      <td>3</td>\n      <td>3</td>\n      <td>10</td>\n      <td>8</td>\n      <td>7</td>\n    </tr>\n    <tr>\n      <th>393</th>\n      <td>MS</td>\n      <td>M</td>\n      <td>18</td>\n      <td>R</td>\n      <td>LE3</td>\n      <td>T</td>\n      <td>3</td>\n      <td>2</td>\n      <td>Services</td>\n      <td>Other</td>\n      <td>...</td>\n      <td>4</td>\n      <td>4</td>\n      <td>1</td>\n      <td>3</td>\n      <td>4</td>\n      <td>5</td>\n      <td>0</td>\n      <td>11</td>\n      <td>12</td>\n      <td>10</td>\n    </tr>\n    <tr>\n      <th>394</th>\n      <td>MS</td>\n      <td>M</td>\n      <td>19</td>\n      <td>U</td>\n      <td>LE3</td>\n      <td>T</td>\n      <td>1</td>\n      <td>1</td>\n      <td>Other</td>\n      <td>At_home</td>\n      <td>...</td>\n      <td>3</td>\n      <td>2</td>\n      <td>3</td>\n      <td>3</td>\n      <td>3</td>\n      <td>5</td>\n      <td>5</td>\n      <td>8</td>\n      <td>9</td>\n      <td>9</td>\n    </tr>\n  </tbody>\n</table>\n<p>395 rows × 33 columns</p>\n</div>"
     },
     "execution_count": 55,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df[[\"Mjob\",\"Fjob\"]] = df[[\"Mjob\",\"Fjob\"]].applymap(capitalizer)\n",
    "df"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Step 9. Create a function called majority that returns a boolean value to a new column called legal_drinker (Consider majority as older than 17 years old)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 56,
   "metadata": {
    "collapsed": false,
    "ExecuteTime": {
     "end_time": "2024-01-13T08:43:59.539534Z",
     "start_time": "2024-01-13T08:43:59.459072Z"
    }
   },
   "outputs": [],
   "source": [
    "def majority(age):\n",
    "    return age > 17"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 57,
   "metadata": {
    "collapsed": false,
    "ExecuteTime": {
     "end_time": "2024-01-13T08:43:59.587605Z",
     "start_time": "2024-01-13T08:43:59.466197Z"
    }
   },
   "outputs": [
    {
     "data": {
      "text/plain": "    school sex  age address famsize Pstatus  Medu  Fedu      Mjob      Fjob  \\\n0       GP   F   18       U     GT3       A     4     4   At_home   Teacher   \n1       GP   F   17       U     GT3       T     1     1   At_home     Other   \n2       GP   F   15       U     LE3       T     1     1   At_home     Other   \n3       GP   F   15       U     GT3       T     4     2    Health  Services   \n4       GP   F   16       U     GT3       T     3     3     Other     Other   \n..     ...  ..  ...     ...     ...     ...   ...   ...       ...       ...   \n390     MS   M   20       U     LE3       A     2     2  Services  Services   \n391     MS   M   17       U     LE3       T     3     1  Services  Services   \n392     MS   M   21       R     GT3       T     1     1     Other     Other   \n393     MS   M   18       R     LE3       T     3     2  Services     Other   \n394     MS   M   19       U     LE3       T     1     1     Other   At_home   \n\n     ... freetime goout  Dalc  Walc  health absences  G1  G2  G3 legal_drinker  \n0    ...        3     4     1     1       3        6   5   6   6          True  \n1    ...        3     3     1     1       3        4   5   5   6         False  \n2    ...        3     2     2     3       3       10   7   8  10         False  \n3    ...        2     2     1     1       5        2  15  14  15         False  \n4    ...        3     2     1     2       5        4   6  10  10         False  \n..   ...      ...   ...   ...   ...     ...      ...  ..  ..  ..           ...  \n390  ...        5     4     4     5       4       11   9   9   9          True  \n391  ...        4     5     3     4       2        3  14  16  16         False  \n392  ...        5     3     3     3       3        3  10   8   7          True  \n393  ...        4     1     3     4       5        0  11  12  10          True  \n394  ...        2     3     3     3       5        5   8   9   9          True  \n\n[395 rows x 34 columns]",
      "text/html": "<div>\n<style scoped>\n    .dataframe tbody tr th:only-of-type {\n        vertical-align: middle;\n    }\n\n    .dataframe tbody tr th {\n        vertical-align: top;\n    }\n\n    .dataframe thead th {\n        text-align: right;\n    }\n</style>\n<table border=\"1\" class=\"dataframe\">\n  <thead>\n    <tr style=\"text-align: right;\">\n      <th></th>\n      <th>school</th>\n      <th>sex</th>\n      <th>age</th>\n      <th>address</th>\n      <th>famsize</th>\n      <th>Pstatus</th>\n      <th>Medu</th>\n      <th>Fedu</th>\n      <th>Mjob</th>\n      <th>Fjob</th>\n      <th>...</th>\n      <th>freetime</th>\n      <th>goout</th>\n      <th>Dalc</th>\n      <th>Walc</th>\n      <th>health</th>\n      <th>absences</th>\n      <th>G1</th>\n      <th>G2</th>\n      <th>G3</th>\n      <th>legal_drinker</th>\n    </tr>\n  </thead>\n  <tbody>\n    <tr>\n      <th>0</th>\n      <td>GP</td>\n      <td>F</td>\n      <td>18</td>\n      <td>U</td>\n      <td>GT3</td>\n      <td>A</td>\n      <td>4</td>\n      <td>4</td>\n      <td>At_home</td>\n      <td>Teacher</td>\n      <td>...</td>\n      <td>3</td>\n      <td>4</td>\n      <td>1</td>\n      <td>1</td>\n      <td>3</td>\n      <td>6</td>\n      <td>5</td>\n      <td>6</td>\n      <td>6</td>\n      <td>True</td>\n    </tr>\n    <tr>\n      <th>1</th>\n      <td>GP</td>\n      <td>F</td>\n      <td>17</td>\n      <td>U</td>\n      <td>GT3</td>\n      <td>T</td>\n      <td>1</td>\n      <td>1</td>\n      <td>At_home</td>\n      <td>Other</td>\n      <td>...</td>\n      <td>3</td>\n      <td>3</td>\n      <td>1</td>\n      <td>1</td>\n      <td>3</td>\n      <td>4</td>\n      <td>5</td>\n      <td>5</td>\n      <td>6</td>\n      <td>False</td>\n    </tr>\n    <tr>\n      <th>2</th>\n      <td>GP</td>\n      <td>F</td>\n      <td>15</td>\n      <td>U</td>\n      <td>LE3</td>\n      <td>T</td>\n      <td>1</td>\n      <td>1</td>\n      <td>At_home</td>\n      <td>Other</td>\n      <td>...</td>\n      <td>3</td>\n      <td>2</td>\n      <td>2</td>\n      <td>3</td>\n      <td>3</td>\n      <td>10</td>\n      <td>7</td>\n      <td>8</td>\n      <td>10</td>\n      <td>False</td>\n    </tr>\n    <tr>\n      <th>3</th>\n      <td>GP</td>\n      <td>F</td>\n      <td>15</td>\n      <td>U</td>\n      <td>GT3</td>\n      <td>T</td>\n      <td>4</td>\n      <td>2</td>\n      <td>Health</td>\n      <td>Services</td>\n      <td>...</td>\n      <td>2</td>\n      <td>2</td>\n      <td>1</td>\n      <td>1</td>\n      <td>5</td>\n      <td>2</td>\n      <td>15</td>\n      <td>14</td>\n      <td>15</td>\n      <td>False</td>\n    </tr>\n    <tr>\n      <th>4</th>\n      <td>GP</td>\n      <td>F</td>\n      <td>16</td>\n      <td>U</td>\n      <td>GT3</td>\n      <td>T</td>\n      <td>3</td>\n      <td>3</td>\n      <td>Other</td>\n      <td>Other</td>\n      <td>...</td>\n      <td>3</td>\n      <td>2</td>\n      <td>1</td>\n      <td>2</td>\n      <td>5</td>\n      <td>4</td>\n      <td>6</td>\n      <td>10</td>\n      <td>10</td>\n      <td>False</td>\n    </tr>\n    <tr>\n      <th>...</th>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n    </tr>\n    <tr>\n      <th>390</th>\n      <td>MS</td>\n      <td>M</td>\n      <td>20</td>\n      <td>U</td>\n      <td>LE3</td>\n      <td>A</td>\n      <td>2</td>\n      <td>2</td>\n      <td>Services</td>\n      <td>Services</td>\n      <td>...</td>\n      <td>5</td>\n      <td>4</td>\n      <td>4</td>\n      <td>5</td>\n      <td>4</td>\n      <td>11</td>\n      <td>9</td>\n      <td>9</td>\n      <td>9</td>\n      <td>True</td>\n    </tr>\n    <tr>\n      <th>391</th>\n      <td>MS</td>\n      <td>M</td>\n      <td>17</td>\n      <td>U</td>\n      <td>LE3</td>\n      <td>T</td>\n      <td>3</td>\n      <td>1</td>\n      <td>Services</td>\n      <td>Services</td>\n      <td>...</td>\n      <td>4</td>\n      <td>5</td>\n      <td>3</td>\n      <td>4</td>\n      <td>2</td>\n      <td>3</td>\n      <td>14</td>\n      <td>16</td>\n      <td>16</td>\n      <td>False</td>\n    </tr>\n    <tr>\n      <th>392</th>\n      <td>MS</td>\n      <td>M</td>\n      <td>21</td>\n      <td>R</td>\n      <td>GT3</td>\n      <td>T</td>\n      <td>1</td>\n      <td>1</td>\n      <td>Other</td>\n      <td>Other</td>\n      <td>...</td>\n      <td>5</td>\n      <td>3</td>\n      <td>3</td>\n      <td>3</td>\n      <td>3</td>\n      <td>3</td>\n      <td>10</td>\n      <td>8</td>\n      <td>7</td>\n      <td>True</td>\n    </tr>\n    <tr>\n      <th>393</th>\n      <td>MS</td>\n      <td>M</td>\n      <td>18</td>\n      <td>R</td>\n      <td>LE3</td>\n      <td>T</td>\n      <td>3</td>\n      <td>2</td>\n      <td>Services</td>\n      <td>Other</td>\n      <td>...</td>\n      <td>4</td>\n      <td>1</td>\n      <td>3</td>\n      <td>4</td>\n      <td>5</td>\n      <td>0</td>\n      <td>11</td>\n      <td>12</td>\n      <td>10</td>\n      <td>True</td>\n    </tr>\n    <tr>\n      <th>394</th>\n      <td>MS</td>\n      <td>M</td>\n      <td>19</td>\n      <td>U</td>\n      <td>LE3</td>\n      <td>T</td>\n      <td>1</td>\n      <td>1</td>\n      <td>Other</td>\n      <td>At_home</td>\n      <td>...</td>\n      <td>2</td>\n      <td>3</td>\n      <td>3</td>\n      <td>3</td>\n      <td>5</td>\n      <td>5</td>\n      <td>8</td>\n      <td>9</td>\n      <td>9</td>\n      <td>True</td>\n    </tr>\n  </tbody>\n</table>\n<p>395 rows × 34 columns</p>\n</div>"
     },
     "execution_count": 57,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df['legal_drinker'] = df['age'].apply(majority)\n",
    "df"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 58,
   "outputs": [
    {
     "data": {
      "text/plain": "    school sex  age address famsize Pstatus  Medu  Fedu      Mjob      Fjob  \\\n0       GP   F   18       U     GT3       A     4     4   At_home   Teacher   \n1       GP   F   17       U     GT3       T     1     1   At_home     Other   \n2       GP   F   15       U     LE3       T     1     1   At_home     Other   \n3       GP   F   15       U     GT3       T     4     2    Health  Services   \n4       GP   F   16       U     GT3       T     3     3     Other     Other   \n..     ...  ..  ...     ...     ...     ...   ...   ...       ...       ...   \n390     MS   M   20       U     LE3       A     2     2  Services  Services   \n391     MS   M   17       U     LE3       T     3     1  Services  Services   \n392     MS   M   21       R     GT3       T     1     1     Other     Other   \n393     MS   M   18       R     LE3       T     3     2  Services     Other   \n394     MS   M   19       U     LE3       T     1     1     Other   At_home   \n\n     ... freetime goout  Dalc  Walc  health absences  G1  G2  G3 legal_drinker  \n0    ...        3     4     1     1       3        6   5   6   6          True  \n1    ...        3     3     1     1       3        4   5   5   6         False  \n2    ...        3     2     2     3       3       10   7   8  10         False  \n3    ...        2     2     1     1       5        2  15  14  15         False  \n4    ...        3     2     1     2       5        4   6  10  10         False  \n..   ...      ...   ...   ...   ...     ...      ...  ..  ..  ..           ...  \n390  ...        5     4     4     5       4       11   9   9   9          True  \n391  ...        4     5     3     4       2        3  14  16  16         False  \n392  ...        5     3     3     3       3        3  10   8   7          True  \n393  ...        4     1     3     4       5        0  11  12  10          True  \n394  ...        2     3     3     3       5        5   8   9   9          True  \n\n[395 rows x 34 columns]",
      "text/html": "<div>\n<style scoped>\n    .dataframe tbody tr th:only-of-type {\n        vertical-align: middle;\n    }\n\n    .dataframe tbody tr th {\n        vertical-align: top;\n    }\n\n    .dataframe thead th {\n        text-align: right;\n    }\n</style>\n<table border=\"1\" class=\"dataframe\">\n  <thead>\n    <tr style=\"text-align: right;\">\n      <th></th>\n      <th>school</th>\n      <th>sex</th>\n      <th>age</th>\n      <th>address</th>\n      <th>famsize</th>\n      <th>Pstatus</th>\n      <th>Medu</th>\n      <th>Fedu</th>\n      <th>Mjob</th>\n      <th>Fjob</th>\n      <th>...</th>\n      <th>freetime</th>\n      <th>goout</th>\n      <th>Dalc</th>\n      <th>Walc</th>\n      <th>health</th>\n      <th>absences</th>\n      <th>G1</th>\n      <th>G2</th>\n      <th>G3</th>\n      <th>legal_drinker</th>\n    </tr>\n  </thead>\n  <tbody>\n    <tr>\n      <th>0</th>\n      <td>GP</td>\n      <td>F</td>\n      <td>18</td>\n      <td>U</td>\n      <td>GT3</td>\n      <td>A</td>\n      <td>4</td>\n      <td>4</td>\n      <td>At_home</td>\n      <td>Teacher</td>\n      <td>...</td>\n      <td>3</td>\n      <td>4</td>\n      <td>1</td>\n      <td>1</td>\n      <td>3</td>\n      <td>6</td>\n      <td>5</td>\n      <td>6</td>\n      <td>6</td>\n      <td>True</td>\n    </tr>\n    <tr>\n      <th>1</th>\n      <td>GP</td>\n      <td>F</td>\n      <td>17</td>\n      <td>U</td>\n      <td>GT3</td>\n      <td>T</td>\n      <td>1</td>\n      <td>1</td>\n      <td>At_home</td>\n      <td>Other</td>\n      <td>...</td>\n      <td>3</td>\n      <td>3</td>\n      <td>1</td>\n      <td>1</td>\n      <td>3</td>\n      <td>4</td>\n      <td>5</td>\n      <td>5</td>\n      <td>6</td>\n      <td>False</td>\n    </tr>\n    <tr>\n      <th>2</th>\n      <td>GP</td>\n      <td>F</td>\n      <td>15</td>\n      <td>U</td>\n      <td>LE3</td>\n      <td>T</td>\n      <td>1</td>\n      <td>1</td>\n      <td>At_home</td>\n      <td>Other</td>\n      <td>...</td>\n      <td>3</td>\n      <td>2</td>\n      <td>2</td>\n      <td>3</td>\n      <td>3</td>\n      <td>10</td>\n      <td>7</td>\n      <td>8</td>\n      <td>10</td>\n      <td>False</td>\n    </tr>\n    <tr>\n      <th>3</th>\n      <td>GP</td>\n      <td>F</td>\n      <td>15</td>\n      <td>U</td>\n      <td>GT3</td>\n      <td>T</td>\n      <td>4</td>\n      <td>2</td>\n      <td>Health</td>\n      <td>Services</td>\n      <td>...</td>\n      <td>2</td>\n      <td>2</td>\n      <td>1</td>\n      <td>1</td>\n      <td>5</td>\n      <td>2</td>\n      <td>15</td>\n      <td>14</td>\n      <td>15</td>\n      <td>False</td>\n    </tr>\n    <tr>\n      <th>4</th>\n      <td>GP</td>\n      <td>F</td>\n      <td>16</td>\n      <td>U</td>\n      <td>GT3</td>\n      <td>T</td>\n      <td>3</td>\n      <td>3</td>\n      <td>Other</td>\n      <td>Other</td>\n      <td>...</td>\n      <td>3</td>\n      <td>2</td>\n      <td>1</td>\n      <td>2</td>\n      <td>5</td>\n      <td>4</td>\n      <td>6</td>\n      <td>10</td>\n      <td>10</td>\n      <td>False</td>\n    </tr>\n    <tr>\n      <th>...</th>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n    </tr>\n    <tr>\n      <th>390</th>\n      <td>MS</td>\n      <td>M</td>\n      <td>20</td>\n      <td>U</td>\n      <td>LE3</td>\n      <td>A</td>\n      <td>2</td>\n      <td>2</td>\n      <td>Services</td>\n      <td>Services</td>\n      <td>...</td>\n      <td>5</td>\n      <td>4</td>\n      <td>4</td>\n      <td>5</td>\n      <td>4</td>\n      <td>11</td>\n      <td>9</td>\n      <td>9</td>\n      <td>9</td>\n      <td>True</td>\n    </tr>\n    <tr>\n      <th>391</th>\n      <td>MS</td>\n      <td>M</td>\n      <td>17</td>\n      <td>U</td>\n      <td>LE3</td>\n      <td>T</td>\n      <td>3</td>\n      <td>1</td>\n      <td>Services</td>\n      <td>Services</td>\n      <td>...</td>\n      <td>4</td>\n      <td>5</td>\n      <td>3</td>\n      <td>4</td>\n      <td>2</td>\n      <td>3</td>\n      <td>14</td>\n      <td>16</td>\n      <td>16</td>\n      <td>False</td>\n    </tr>\n    <tr>\n      <th>392</th>\n      <td>MS</td>\n      <td>M</td>\n      <td>21</td>\n      <td>R</td>\n      <td>GT3</td>\n      <td>T</td>\n      <td>1</td>\n      <td>1</td>\n      <td>Other</td>\n      <td>Other</td>\n      <td>...</td>\n      <td>5</td>\n      <td>3</td>\n      <td>3</td>\n      <td>3</td>\n      <td>3</td>\n      <td>3</td>\n      <td>10</td>\n      <td>8</td>\n      <td>7</td>\n      <td>True</td>\n    </tr>\n    <tr>\n      <th>393</th>\n      <td>MS</td>\n      <td>M</td>\n      <td>18</td>\n      <td>R</td>\n      <td>LE3</td>\n      <td>T</td>\n      <td>3</td>\n      <td>2</td>\n      <td>Services</td>\n      <td>Other</td>\n      <td>...</td>\n      <td>4</td>\n      <td>1</td>\n      <td>3</td>\n      <td>4</td>\n      <td>5</td>\n      <td>0</td>\n      <td>11</td>\n      <td>12</td>\n      <td>10</td>\n      <td>True</td>\n    </tr>\n    <tr>\n      <th>394</th>\n      <td>MS</td>\n      <td>M</td>\n      <td>19</td>\n      <td>U</td>\n      <td>LE3</td>\n      <td>T</td>\n      <td>1</td>\n      <td>1</td>\n      <td>Other</td>\n      <td>At_home</td>\n      <td>...</td>\n      <td>2</td>\n      <td>3</td>\n      <td>3</td>\n      <td>3</td>\n      <td>5</td>\n      <td>5</td>\n      <td>8</td>\n      <td>9</td>\n      <td>9</td>\n      <td>True</td>\n    </tr>\n  </tbody>\n</table>\n<p>395 rows × 34 columns</p>\n</div>"
     },
     "execution_count": 58,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df.assign(legal_drinker = lambda x: x['age'] > 17)"
   ],
   "metadata": {
    "collapsed": false,
    "ExecuteTime": {
     "end_time": "2024-01-13T08:43:59.590279Z",
     "start_time": "2024-01-13T08:43:59.501898Z"
    }
   }
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Step 10. Multiply every number of the dataset by 10. \n",
    "##### I know this makes no sense, don't forget it is just an exercise"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 59,
   "metadata": {
    "collapsed": false,
    "ExecuteTime": {
     "end_time": "2024-01-13T08:43:59.621578Z",
     "start_time": "2024-01-13T08:43:59.506864Z"
    }
   },
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "/var/folders/wp/lkkwcrwn3zj0rrhwk9j6lffm0000gn/T/ipykernel_7733/1894385345.py:4: FutureWarning: DataFrame.applymap has been deprecated. Use DataFrame.map instead.\n",
      "  df_result = numeric_columns.applymap(lambda x: x * 10)\n"
     ]
    },
    {
     "data": {
      "text/plain": "    school sex  age address famsize Pstatus  Medu  Fedu      Mjob      Fjob  \\\n0       GP   F  180       U     GT3       A    40    40   At_home   Teacher   \n1       GP   F  170       U     GT3       T    10    10   At_home     Other   \n2       GP   F  150       U     LE3       T    10    10   At_home     Other   \n3       GP   F  150       U     GT3       T    40    20    Health  Services   \n4       GP   F  160       U     GT3       T    30    30     Other     Other   \n..     ...  ..  ...     ...     ...     ...   ...   ...       ...       ...   \n390     MS   M  200       U     LE3       A    20    20  Services  Services   \n391     MS   M  170       U     LE3       T    30    10  Services  Services   \n392     MS   M  210       R     GT3       T    10    10     Other     Other   \n393     MS   M  180       R     LE3       T    30    20  Services     Other   \n394     MS   M  190       U     LE3       T    10    10     Other   At_home   \n\n     ... freetime goout  Dalc  Walc  health absences   G1   G2   G3  \\\n0    ...       30    40    10    10      30       60   50   60   60   \n1    ...       30    30    10    10      30       40   50   50   60   \n2    ...       30    20    20    30      30      100   70   80  100   \n3    ...       20    20    10    10      50       20  150  140  150   \n4    ...       30    20    10    20      50       40   60  100  100   \n..   ...      ...   ...   ...   ...     ...      ...  ...  ...  ...   \n390  ...       50    40    40    50      40      110   90   90   90   \n391  ...       40    50    30    40      20       30  140  160  160   \n392  ...       50    30    30    30      30       30  100   80   70   \n393  ...       40    10    30    40      50        0  110  120  100   \n394  ...       20    30    30    30      50       50   80   90   90   \n\n    legal_drinker  \n0            True  \n1           False  \n2           False  \n3           False  \n4           False  \n..            ...  \n390          True  \n391         False  \n392          True  \n393          True  \n394          True  \n\n[395 rows x 34 columns]",
      "text/html": "<div>\n<style scoped>\n    .dataframe tbody tr th:only-of-type {\n        vertical-align: middle;\n    }\n\n    .dataframe tbody tr th {\n        vertical-align: top;\n    }\n\n    .dataframe thead th {\n        text-align: right;\n    }\n</style>\n<table border=\"1\" class=\"dataframe\">\n  <thead>\n    <tr style=\"text-align: right;\">\n      <th></th>\n      <th>school</th>\n      <th>sex</th>\n      <th>age</th>\n      <th>address</th>\n      <th>famsize</th>\n      <th>Pstatus</th>\n      <th>Medu</th>\n      <th>Fedu</th>\n      <th>Mjob</th>\n      <th>Fjob</th>\n      <th>...</th>\n      <th>freetime</th>\n      <th>goout</th>\n      <th>Dalc</th>\n      <th>Walc</th>\n      <th>health</th>\n      <th>absences</th>\n      <th>G1</th>\n      <th>G2</th>\n      <th>G3</th>\n      <th>legal_drinker</th>\n    </tr>\n  </thead>\n  <tbody>\n    <tr>\n      <th>0</th>\n      <td>GP</td>\n      <td>F</td>\n      <td>180</td>\n      <td>U</td>\n      <td>GT3</td>\n      <td>A</td>\n      <td>40</td>\n      <td>40</td>\n      <td>At_home</td>\n      <td>Teacher</td>\n      <td>...</td>\n      <td>30</td>\n      <td>40</td>\n      <td>10</td>\n      <td>10</td>\n      <td>30</td>\n      <td>60</td>\n      <td>50</td>\n      <td>60</td>\n      <td>60</td>\n      <td>True</td>\n    </tr>\n    <tr>\n      <th>1</th>\n      <td>GP</td>\n      <td>F</td>\n      <td>170</td>\n      <td>U</td>\n      <td>GT3</td>\n      <td>T</td>\n      <td>10</td>\n      <td>10</td>\n      <td>At_home</td>\n      <td>Other</td>\n      <td>...</td>\n      <td>30</td>\n      <td>30</td>\n      <td>10</td>\n      <td>10</td>\n      <td>30</td>\n      <td>40</td>\n      <td>50</td>\n      <td>50</td>\n      <td>60</td>\n      <td>False</td>\n    </tr>\n    <tr>\n      <th>2</th>\n      <td>GP</td>\n      <td>F</td>\n      <td>150</td>\n      <td>U</td>\n      <td>LE3</td>\n      <td>T</td>\n      <td>10</td>\n      <td>10</td>\n      <td>At_home</td>\n      <td>Other</td>\n      <td>...</td>\n      <td>30</td>\n      <td>20</td>\n      <td>20</td>\n      <td>30</td>\n      <td>30</td>\n      <td>100</td>\n      <td>70</td>\n      <td>80</td>\n      <td>100</td>\n      <td>False</td>\n    </tr>\n    <tr>\n      <th>3</th>\n      <td>GP</td>\n      <td>F</td>\n      <td>150</td>\n      <td>U</td>\n      <td>GT3</td>\n      <td>T</td>\n      <td>40</td>\n      <td>20</td>\n      <td>Health</td>\n      <td>Services</td>\n      <td>...</td>\n      <td>20</td>\n      <td>20</td>\n      <td>10</td>\n      <td>10</td>\n      <td>50</td>\n      <td>20</td>\n      <td>150</td>\n      <td>140</td>\n      <td>150</td>\n      <td>False</td>\n    </tr>\n    <tr>\n      <th>4</th>\n      <td>GP</td>\n      <td>F</td>\n      <td>160</td>\n      <td>U</td>\n      <td>GT3</td>\n      <td>T</td>\n      <td>30</td>\n      <td>30</td>\n      <td>Other</td>\n      <td>Other</td>\n      <td>...</td>\n      <td>30</td>\n      <td>20</td>\n      <td>10</td>\n      <td>20</td>\n      <td>50</td>\n      <td>40</td>\n      <td>60</td>\n      <td>100</td>\n      <td>100</td>\n      <td>False</td>\n    </tr>\n    <tr>\n      <th>...</th>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n    </tr>\n    <tr>\n      <th>390</th>\n      <td>MS</td>\n      <td>M</td>\n      <td>200</td>\n      <td>U</td>\n      <td>LE3</td>\n      <td>A</td>\n      <td>20</td>\n      <td>20</td>\n      <td>Services</td>\n      <td>Services</td>\n      <td>...</td>\n      <td>50</td>\n      <td>40</td>\n      <td>40</td>\n      <td>50</td>\n      <td>40</td>\n      <td>110</td>\n      <td>90</td>\n      <td>90</td>\n      <td>90</td>\n      <td>True</td>\n    </tr>\n    <tr>\n      <th>391</th>\n      <td>MS</td>\n      <td>M</td>\n      <td>170</td>\n      <td>U</td>\n      <td>LE3</td>\n      <td>T</td>\n      <td>30</td>\n      <td>10</td>\n      <td>Services</td>\n      <td>Services</td>\n      <td>...</td>\n      <td>40</td>\n      <td>50</td>\n      <td>30</td>\n      <td>40</td>\n      <td>20</td>\n      <td>30</td>\n      <td>140</td>\n      <td>160</td>\n      <td>160</td>\n      <td>False</td>\n    </tr>\n    <tr>\n      <th>392</th>\n      <td>MS</td>\n      <td>M</td>\n      <td>210</td>\n      <td>R</td>\n      <td>GT3</td>\n      <td>T</td>\n      <td>10</td>\n      <td>10</td>\n      <td>Other</td>\n      <td>Other</td>\n      <td>...</td>\n      <td>50</td>\n      <td>30</td>\n      <td>30</td>\n      <td>30</td>\n      <td>30</td>\n      <td>30</td>\n      <td>100</td>\n      <td>80</td>\n      <td>70</td>\n      <td>True</td>\n    </tr>\n    <tr>\n      <th>393</th>\n      <td>MS</td>\n      <td>M</td>\n      <td>180</td>\n      <td>R</td>\n      <td>LE3</td>\n      <td>T</td>\n      <td>30</td>\n      <td>20</td>\n      <td>Services</td>\n      <td>Other</td>\n      <td>...</td>\n      <td>40</td>\n      <td>10</td>\n      <td>30</td>\n      <td>40</td>\n      <td>50</td>\n      <td>0</td>\n      <td>110</td>\n      <td>120</td>\n      <td>100</td>\n      <td>True</td>\n    </tr>\n    <tr>\n      <th>394</th>\n      <td>MS</td>\n      <td>M</td>\n      <td>190</td>\n      <td>U</td>\n      <td>LE3</td>\n      <td>T</td>\n      <td>10</td>\n      <td>10</td>\n      <td>Other</td>\n      <td>At_home</td>\n      <td>...</td>\n      <td>20</td>\n      <td>30</td>\n      <td>30</td>\n      <td>30</td>\n      <td>50</td>\n      <td>50</td>\n      <td>80</td>\n      <td>90</td>\n      <td>90</td>\n      <td>True</td>\n    </tr>\n  </tbody>\n</table>\n<p>395 rows × 34 columns</p>\n</div>"
     },
     "execution_count": 59,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# Filter numeric columns\n",
    "numeric_columns = df.select_dtypes(include='number')\n",
    "# Multiply every number in the numeric columns by 10\n",
    "df_result = numeric_columns.applymap(lambda x: x * 10)\n",
    "\n",
    "# Update the original DataFrame with the modified numeric columns\n",
    "df[numeric_columns.columns] = df_result\n",
    "df"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 60,
   "metadata": {
    "collapsed": false,
    "ExecuteTime": {
     "end_time": "2024-01-13T08:43:59.679595Z",
     "start_time": "2024-01-13T08:43:59.547706Z"
    }
   },
   "outputs": [
    {
     "data": {
      "text/plain": "    school sex  age address famsize Pstatus  Medu  Fedu      Mjob      Fjob  \\\n0       GP   F  180       U     GT3       A    40    40   At_home   Teacher   \n1       GP   F  170       U     GT3       T    10    10   At_home     Other   \n2       GP   F  150       U     LE3       T    10    10   At_home     Other   \n3       GP   F  150       U     GT3       T    40    20    Health  Services   \n4       GP   F  160       U     GT3       T    30    30     Other     Other   \n..     ...  ..  ...     ...     ...     ...   ...   ...       ...       ...   \n390     MS   M  200       U     LE3       A    20    20  Services  Services   \n391     MS   M  170       U     LE3       T    30    10  Services  Services   \n392     MS   M  210       R     GT3       T    10    10     Other     Other   \n393     MS   M  180       R     LE3       T    30    20  Services     Other   \n394     MS   M  190       U     LE3       T    10    10     Other   At_home   \n\n     ... freetime goout  Dalc  Walc  health absences   G1   G2   G3  \\\n0    ...       30    40    10    10      30       60   50   60   60   \n1    ...       30    30    10    10      30       40   50   50   60   \n2    ...       30    20    20    30      30      100   70   80  100   \n3    ...       20    20    10    10      50       20  150  140  150   \n4    ...       30    20    10    20      50       40   60  100  100   \n..   ...      ...   ...   ...   ...     ...      ...  ...  ...  ...   \n390  ...       50    40    40    50      40      110   90   90   90   \n391  ...       40    50    30    40      20       30  140  160  160   \n392  ...       50    30    30    30      30       30  100   80   70   \n393  ...       40    10    30    40      50        0  110  120  100   \n394  ...       20    30    30    30      50       50   80   90   90   \n\n    legal_drinker  \n0            True  \n1           False  \n2           False  \n3           False  \n4           False  \n..            ...  \n390          True  \n391         False  \n392          True  \n393          True  \n394          True  \n\n[395 rows x 34 columns]",
      "text/html": "<div>\n<style scoped>\n    .dataframe tbody tr th:only-of-type {\n        vertical-align: middle;\n    }\n\n    .dataframe tbody tr th {\n        vertical-align: top;\n    }\n\n    .dataframe thead th {\n        text-align: right;\n    }\n</style>\n<table border=\"1\" class=\"dataframe\">\n  <thead>\n    <tr style=\"text-align: right;\">\n      <th></th>\n      <th>school</th>\n      <th>sex</th>\n      <th>age</th>\n      <th>address</th>\n      <th>famsize</th>\n      <th>Pstatus</th>\n      <th>Medu</th>\n      <th>Fedu</th>\n      <th>Mjob</th>\n      <th>Fjob</th>\n      <th>...</th>\n      <th>freetime</th>\n      <th>goout</th>\n      <th>Dalc</th>\n      <th>Walc</th>\n      <th>health</th>\n      <th>absences</th>\n      <th>G1</th>\n      <th>G2</th>\n      <th>G3</th>\n      <th>legal_drinker</th>\n    </tr>\n  </thead>\n  <tbody>\n    <tr>\n      <th>0</th>\n      <td>GP</td>\n      <td>F</td>\n      <td>180</td>\n      <td>U</td>\n      <td>GT3</td>\n      <td>A</td>\n      <td>40</td>\n      <td>40</td>\n      <td>At_home</td>\n      <td>Teacher</td>\n      <td>...</td>\n      <td>30</td>\n      <td>40</td>\n      <td>10</td>\n      <td>10</td>\n      <td>30</td>\n      <td>60</td>\n      <td>50</td>\n      <td>60</td>\n      <td>60</td>\n      <td>True</td>\n    </tr>\n    <tr>\n      <th>1</th>\n      <td>GP</td>\n      <td>F</td>\n      <td>170</td>\n      <td>U</td>\n      <td>GT3</td>\n      <td>T</td>\n      <td>10</td>\n      <td>10</td>\n      <td>At_home</td>\n      <td>Other</td>\n      <td>...</td>\n      <td>30</td>\n      <td>30</td>\n      <td>10</td>\n      <td>10</td>\n      <td>30</td>\n      <td>40</td>\n      <td>50</td>\n      <td>50</td>\n      <td>60</td>\n      <td>False</td>\n    </tr>\n    <tr>\n      <th>2</th>\n      <td>GP</td>\n      <td>F</td>\n      <td>150</td>\n      <td>U</td>\n      <td>LE3</td>\n      <td>T</td>\n      <td>10</td>\n      <td>10</td>\n      <td>At_home</td>\n      <td>Other</td>\n      <td>...</td>\n      <td>30</td>\n      <td>20</td>\n      <td>20</td>\n      <td>30</td>\n      <td>30</td>\n      <td>100</td>\n      <td>70</td>\n      <td>80</td>\n      <td>100</td>\n      <td>False</td>\n    </tr>\n    <tr>\n      <th>3</th>\n      <td>GP</td>\n      <td>F</td>\n      <td>150</td>\n      <td>U</td>\n      <td>GT3</td>\n      <td>T</td>\n      <td>40</td>\n      <td>20</td>\n      <td>Health</td>\n      <td>Services</td>\n      <td>...</td>\n      <td>20</td>\n      <td>20</td>\n      <td>10</td>\n      <td>10</td>\n      <td>50</td>\n      <td>20</td>\n      <td>150</td>\n      <td>140</td>\n      <td>150</td>\n      <td>False</td>\n    </tr>\n    <tr>\n      <th>4</th>\n      <td>GP</td>\n      <td>F</td>\n      <td>160</td>\n      <td>U</td>\n      <td>GT3</td>\n      <td>T</td>\n      <td>30</td>\n      <td>30</td>\n      <td>Other</td>\n      <td>Other</td>\n      <td>...</td>\n      <td>30</td>\n      <td>20</td>\n      <td>10</td>\n      <td>20</td>\n      <td>50</td>\n      <td>40</td>\n      <td>60</td>\n      <td>100</td>\n      <td>100</td>\n      <td>False</td>\n    </tr>\n    <tr>\n      <th>...</th>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n    </tr>\n    <tr>\n      <th>390</th>\n      <td>MS</td>\n      <td>M</td>\n      <td>200</td>\n      <td>U</td>\n      <td>LE3</td>\n      <td>A</td>\n      <td>20</td>\n      <td>20</td>\n      <td>Services</td>\n      <td>Services</td>\n      <td>...</td>\n      <td>50</td>\n      <td>40</td>\n      <td>40</td>\n      <td>50</td>\n      <td>40</td>\n      <td>110</td>\n      <td>90</td>\n      <td>90</td>\n      <td>90</td>\n      <td>True</td>\n    </tr>\n    <tr>\n      <th>391</th>\n      <td>MS</td>\n      <td>M</td>\n      <td>170</td>\n      <td>U</td>\n      <td>LE3</td>\n      <td>T</td>\n      <td>30</td>\n      <td>10</td>\n      <td>Services</td>\n      <td>Services</td>\n      <td>...</td>\n      <td>40</td>\n      <td>50</td>\n      <td>30</td>\n      <td>40</td>\n      <td>20</td>\n      <td>30</td>\n      <td>140</td>\n      <td>160</td>\n      <td>160</td>\n      <td>False</td>\n    </tr>\n    <tr>\n      <th>392</th>\n      <td>MS</td>\n      <td>M</td>\n      <td>210</td>\n      <td>R</td>\n      <td>GT3</td>\n      <td>T</td>\n      <td>10</td>\n      <td>10</td>\n      <td>Other</td>\n      <td>Other</td>\n      <td>...</td>\n      <td>50</td>\n      <td>30</td>\n      <td>30</td>\n      <td>30</td>\n      <td>30</td>\n      <td>30</td>\n      <td>100</td>\n      <td>80</td>\n      <td>70</td>\n      <td>True</td>\n    </tr>\n    <tr>\n      <th>393</th>\n      <td>MS</td>\n      <td>M</td>\n      <td>180</td>\n      <td>R</td>\n      <td>LE3</td>\n      <td>T</td>\n      <td>30</td>\n      <td>20</td>\n      <td>Services</td>\n      <td>Other</td>\n      <td>...</td>\n      <td>40</td>\n      <td>10</td>\n      <td>30</td>\n      <td>40</td>\n      <td>50</td>\n      <td>0</td>\n      <td>110</td>\n      <td>120</td>\n      <td>100</td>\n      <td>True</td>\n    </tr>\n    <tr>\n      <th>394</th>\n      <td>MS</td>\n      <td>M</td>\n      <td>190</td>\n      <td>U</td>\n      <td>LE3</td>\n      <td>T</td>\n      <td>10</td>\n      <td>10</td>\n      <td>Other</td>\n      <td>At_home</td>\n      <td>...</td>\n      <td>20</td>\n      <td>30</td>\n      <td>30</td>\n      <td>30</td>\n      <td>50</td>\n      <td>50</td>\n      <td>80</td>\n      <td>90</td>\n      <td>90</td>\n      <td>True</td>\n    </tr>\n  </tbody>\n</table>\n<p>395 rows × 34 columns</p>\n</div>"
     },
     "execution_count": 60,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 60,
   "outputs": [],
   "source": [],
   "metadata": {
    "collapsed": false,
    "ExecuteTime": {
     "end_time": "2024-01-13T08:43:59.698131Z",
     "start_time": "2024-01-13T08:43:59.559405Z"
    }
   }
  }
 ],
 "metadata": {
  "anaconda-cloud": {},
  "kernelspec": {
   "name": "python3",
   "language": "python",
   "display_name": "Python 3 (ipykernel)"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 2
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython2",
   "version": "2.7.12"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 0
}
